/**
 * @file        state_machine.c
 * @brief       XXXX
 * @note        XXXX
 * @author      靳普诏(puzhao.jin@hopechart.com)
 * @date        2023/08/26
 * @version     1.0

 * @par         修改日志
 * <table>
 * <tr><th>Date         <th>Version     <th>Author      <th> Description
 * <tr><td>2023/08/26   <td>1.0         <td>靳普诏       <td> 创建初始版本
 * @copyright 杭州鸿泉物联网技术股份有限公司
 */
 
#include "state_machine.h"


#define False 0
#define True  1
#define NULL  0

typedef unsigned char Bool;


typedef struct TStateMachineTag TStateMachine;


typedef void (*TStateMachineStateFunction)(TStateMachine *self, void *user_param);


struct TStateMachineTag
{
    TStateMachineStateFunction state_function_;

    void *user_param;
};

static TStateMachine g_state_machine_ = {0};

/******************** 条件判断函数 ***********************/


static Bool L_TStateMachineCondXXX(TStateMachine *self, void *user_param)
{
    Bool result = False;

    return result;
}




/******************** 状态跳转函数 ***********************/


static void L_TStateMachineOnInitSkip(TStateMachine *self, void *user_param)
{
    if (L_TStateMachineCondXXX(self, user_param))
    {
        self->state_function_ = L_TStateMachineOnInitProcess;
    }
}




/******************** 状态执行函数 ***********************/

static void L_TStateMachineOnInitProcess(TStateMachine *self, void *user_param)
{


    L_TStateMachineOnInitSkip(self, user_param);
}



/******************** 任务执行函数 ***********************/



void StateMachineInit(void *user_param)
{
    g_state_machine_.user_param = user_param;
}

void StateMachineRunOnce(void)
{
    if (g_state_machine_.state_function_ != NULL)
    {
        g_state_machine_.state_function_(&g_state_machine_, g_state_machine_.user_param);
    }
}

void StateMachineDone(void)
{
    g_state_machine_.state_function_ = NULL;
    g_state_machine_.skip_function_ = NULL;
    g_state_machine_.user_param = NULL;
}






///< Generated on "2023-08-26 19:56:00" by the tool "gen_hq_file.py >> V20230509_1" 
